<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <meta name="keywords" content="后台管理系统">
    <meta name="description" content="后台管理系统">
    <?php $this->registerCsrfMetaTags() ?>
    <title>后台管理系统</title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a href="index.html"><img src="/images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item active"> <a href="index"><i class="mdi mdi-home"></i> 后台首页</a> </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-palette"></i>用户管理</a>
                            <ul class="nav nav-subnav">
                                <li> <a href="user">用户列表</a> </li>
                                <li> <a href="newuser">生成链接</a> </li>
                                <li> <a href="short">生成短链接</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item">
                            <a data-href='' href="javascript:void(0)" onclick="logout()">
                                <span class="fa fa-power-off"></span>
                                <span class="xn-text">安全退出</span>
                            </a>
                        </li>
                    </ul>
                </nav>

                <div class="sidebar-footer">
                    <p class="copyright">Copyright &copy; 2019. <a target="_blank" href="http://lyear.itshubao.com">IT书包</a> All rights reserved.</p>
                </div>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 后台首页 </span>
                    </div>

                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <img class="img-avatar img-avatar-48 m-r-10" src="/images/users/avatar.jpg" alt="管理员" />
                                <span>管理员 <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
<!--                                <li> <a href="lyear_pages_profile.html"><i class="mdi mdi-account"></i> 个人信息</a> </li>-->
                                <li> <a href="/admin/pass"><i class="mdi mdi-lock-outline"></i> 修改密码</a> </li>
                                <li> <a href="javascript:void(0)"><i class="mdi mdi-delete"></i> 清空缓存</a></li>
                                <li class="divider"></li>
                                <li> <a data-href='' href="javascript:void(0)" onclick="logout()"><i class="mdi mdi-logout-variant"></i> 退出登录</a> </li>
                            </ul>
                        </li>
                    </ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->
        <?= $content ?>
        <!--End 页面主要内容-->
    </div>
</div>

<?php $this->endBody() ?>
</body>
<script>
    /**
     * 退出系统
     */
    function logout() {
        layer.confirm('是否退出当前界面？', {
            btn: ['确定','退出'], //按钮
            area :['300px', '200px'],
            title :'确定退出系统吗？',
            scrollbar:false,
        }, function(){
            // window.location.href ="/default/index";
            $.get('/default/logout',function (e) {
                if (e.code=='1'){
                    window.location.href ="/default/index";
                }
            },'json')
        }, function(){
            layer.msg('老臣告退!', {
                time: 5000, //20s后自动关闭
            });
        });
    }
</script>
</html>
<?php $this->endPage() ?>
